package com.pay.sdk.service.v2;

import java.util.HashMap;

import com.pay.sdk.service.liquidation.v2.BankCardV2Query;
import com.pay.sdk.service.liquidation.v2.MsBankTypeV2Query;
import com.pay.sdk.service.liquidation.v2.MsV2Pay;
import com.pay.sdk.service.liquidation.v2.MsV2PayQuery;
import com.pay.sdk.service.liquidation.v2.THV2Query;

public class LiquidateV2Service {

	 /**
     * 单笔代付
     * @param user_order_no 用户订单号
     * @param amount  金额
     * @param account_type 账户类型
     * @param account_no 账号
     * @param account_name 开户名
     * @param id_type  证件类型
     * @param id  证件号
     * @param tel 电话号码
     * @param bank_code 银行编码
	 * @param currency 
	 * @param attach 
	 * @param refund_notify_url 
	 * @param notify_url 
     * @return json格式结果，返回结果包含字段请参看文档
     */
    public static String payOther(String out_trade_no,String amount,String account_type,String account_name,
    		String account_no,String id_type,String id,String tel,String bank_code,String client_ip,String nonce_str,String account_prop,String bank_type, 
    		String notify_url, String refund_notify_url, String attach, String currency) {

        HashMap<String, String> params = new HashMap<String, String>();
        params.put("out_trade_no", out_trade_no);
        params.put("amount", amount);
        params.put("account_type", account_type);
        params.put("account_name", account_name);
        params.put("account_no", account_no);
        params.put("id_type", id_type);
        params.put("id", id);
        params.put("tel", tel);
        params.put("bank_code", bank_code);
        params.put("bank_type", bank_type);
        params.put("account_prop", account_prop);
        params.put("nonce_str", nonce_str);
        params.put("client_ip", client_ip);
        params.put("currency", currency);
        params.put("attach", attach);
        params.put("refund_notify_url", refund_notify_url);
        params.put("notify_url", notify_url);
        return new MsV2Pay().exec(params);
    }
    
    /**
     * 代付查询
     * @param query_sn 查询交易流水
     * @param user_order_no 用户订单号 二选一
     * @return
     */
    public static String payOtherQuery(String out_trade_no,String nonce_str) {
        HashMap<String, String> params = new HashMap<String, String>();
        params.put("out_trade_no",out_trade_no);
        params.put("nonce_str",nonce_str);
        return new MsV2PayQuery().exec(params);
    }
    
    
    /**
     * 代付银行联行号查询
     * @param bank_code 银行编码
     * @param province  开户省份
     * @param city  开户城市
     * @param branch_name 开户网点关键字
     * @return
     */
    public static String bankTypeQuery(String bank_code,String province,String city,String branch_name,String nonce_str) {
        HashMap<String, String> params = new HashMap<String, String>();
        params.put("bank_code", bank_code);
        params.put("province", province);
        params.put("city",city);
        params.put("branch_name", branch_name);
        params.put("nonce_str", nonce_str);
        return new MsBankTypeV2Query().exec(params);
    }
    
    
    /**
     * 银行卡查询
     * @param card_no 银行编码
     * @param province  开户省份
     * @param city  开户城市
     * @param branch_name 开户网点关键字
     * @return
     */
    public static String bankCardQuery(String card_no,String nonce_str) {
        HashMap<String, String> params = new HashMap<String, String>();
        params.put("card_no", card_no);
        params.put("nonce_str", nonce_str);
        return new BankCardV2Query().exec(params);
    }

    /**
     * 退汇查询
     * @param begin_date
     * @param end_date
     * @return
     */
	public static String queryTh(String begin_date, String end_date,String out_trade_no,String nonce_str) {
		  HashMap<String, String> params = new HashMap<String, String>();
	      params.put("begin_date", begin_date);
	      params.put("end_date", end_date);
	      params.put("out_trade_no", out_trade_no);
	      params.put("nonce_str", nonce_str);
	      return new THV2Query().exec(params);
	}
    
  
}
